package com.plugins.demo;

import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.eclipse.paho.client.mqttv3.MqttTopic;

import com.zxy.common.Com_Fun;
import com.zxy.common.Com_Para;

public class TestMQTTREFLECT_IN_CLASS_Demo implements com.zxy.common.ParamName_InterFace
{
	// MqttMessage
	public StringBuilder	strResult		= new StringBuilder();
	//接收到数据包，默认编码UTF-8
	public byte[]			bytesResult	= null;
	// topic
	public String			param_value1	= null;
	
	public void init_start()
	{
		try
		{
			/***接收MQTT数据***/
			//编码格式转换 UTF-8
			StringBuilder strValue = new StringBuilder(new String(bytesResult,"UTF-8"));
			//字符串打印
			System.out.println("MQTT Message 收到数据(编码格式UTF-8)==>"+strValue);
			//字符串打印
			System.out.println("MQTT Message 收到数据(默认编码格式UTF-8)==>"+strResult.toString());
			//字符串打印
			System.out.println("MQTT topic 收到数据(编码格式UTF-8)==>"+param_value1);
			
			for(String strtopic : Com_Para.MQTT_topic_pull.split(",")){
                String tempayload = strtopic+"    "+Com_Fun.Get_New_GUID()+"    "+Com_Fun.DateTimeStr("yyyy-MM-dd HH:mm:ss")
                	+"    客户端往服务端发送mqtt数据";
                Com_Para.mqclient.publish(strtopic,new MqttMessage(tempayload.getBytes()));
			}
			/***********************************/
		}
		catch(Exception e)
		{
			Com_Fun.debug_in(e,this.toString());
		}
		finally
		{
			
		}
	}
}
